package cn.geminis.warehouse.service.purchase.entity;

import cn.geminis.lowcode.annotation.CrudController;
import cn.geminis.lowcode.annotation.CrudRepository;
import cn.geminis.lowcode.annotation.QueryFilter;
import cn.geminis.lowcode.annotation.UuidEntity;
import cn.geminis.warehouse.service.basic.entity.Route;
import cn.geminis.warehouse.service.basic.entity.Transporter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;


/**
 * 出库单明细
 */
@Getter
@Setter
@UuidEntity
@QueryFilter
@CrudRepository
@CrudController
public class PurchaseRoute {

    /**
     * 入库单
     */
    @ManyToOne(cascade = {CascadeType.ALL}, optional = false)
    @JsonIgnoreProperties
    private Purchase purchase;

    @ManyToOne(optional = false)
    private Route route;

    @Column(nullable = false)
    private int routeDistance;

    @Column(nullable = false)
    private BigDecimal routeDiscount;

    @ManyToOne(optional = false)
    private Transporter transporter;

    @Column(nullable = false)
    private BigDecimal transporterPrice;

}
